import { ZCC_TYPE } from "../../typings/types/common";
import { Debtor } from "../../typings/types/debtor";
import { http, request } from "../utils/request";

export const businessInfoAPI = (name: string) => {
  return http<Debtor.BusinessInfo>({
    url: '/business/getInfo',
    method: 'GET',
    data: {
      name: name || ''
    }
  });
};

export const shareholderAPI = (companyId: string, page: number) => {
  return http<ZCC_TYPE.ListResult<Debtor.Shareholder>>({
    url: '/business/partnerPage',
    method: 'GET',
    data: {
      companyId: companyId,
      page: page,
      perPage: 10
    }
  });
};

export const mainpersonAPI = (companyId: string, page: number) => {
  return http<ZCC_TYPE.ListResult<Debtor.MainPerson>>({
    url: '/business/employeePage',
    method: 'GET',
    data: {
      companyId: companyId,
      page: page,
      perPage: 15
    }
  });
};

export const branchAPI = (companyId: string, page: number) => {
  return http<ZCC_TYPE.ListResult<Debtor.Branch>>({
    url: '/business/branchPage',
    method: 'GET',
    data: {
      companyId: companyId,
      page: page,
      perPage: 10
    }
  });
};
//出资比例类型：0.全部；1.100%；2.66.66%以上；3.50%以上；4.33.33%以上；5.25%以上；6.5%以上
export const investAPI = (companyId: string, page: number, econKind: string, name: string, status: string, stockPercent: number = 0) => {
  const data = {
    companyId: companyId,
    page: page,
    perPage: 10,
    econKind: econKind || '',
    name: name || '',
    status: status || '',
    stockPercent: stockPercent
  }
  console.log("investAPI data = " + JSON.stringify(data))
  return http<ZCC_TYPE.ListResult<Debtor.ODI>>({
    url: '/business/investPage',
    method: 'GET',
    data: data
  });
};

export const econKindAPI = (companyId: string) => {
  return http<string[]>({
    url: '/business/econKind',
    method: 'GET',
    data: {
      companyId: companyId
    }
  });
};

export const changeRecordAPI = (companyId: string, page: number) => {
  return http<ZCC_TYPE.ListResult<Debtor.ChangeRecord>>({
    url: '/business/changeRecordPage',
    method: 'GET',
    data: {
      companyId: companyId,
      page: page,
      perPage: 10
    }
  });
};

// 企业概览 获取债务人财产线索统计
export const getCountInfoAPI = () => {
  return request({
    url: '/data/getCountInfo',
    method: 'GET'
  });
}
// 获取债务人列表(报告相关)
export function reportGetDebtorListApi(params?: any) {
  return request({
    url: '/report/getDebtorList',
    method: 'GET',
    data: params
  })
}
// 债务人查询列表
export function getDebtorListApi(params?: any) {
  return request({
    url: '/debtor/debtorList',
    method: 'GET',
    data: params
  })
}
/** 获得工商信息 */
export function getBusinessInfoApi(params: any) {
  return request({
    url: "/business/getInfo",
    method: "GET",
    data: params
  })
}
/** 股东分页列表 */
export function getPartnerPageInfoApi(params: any) {
  return request({
    url: "/business/partnerPage",
    method: "GET",
    data: params
  })
}
/** 主要人员分页列表 */
export function getEmployeePageInfoApi(params: any) {
  return request({
    url: "/business/employeePage",
    method: "GET",
    data: params
  })
}
// 获取债务人财产线索统计
export function getCountInfoApi(params: any) {
  return request({
    url: "/clue/getCountInfo",
    method: "GET",
    data: params
  })
}
// 基本信息 分类数目统计
export function getBusinessCountApi(params: any) {
  return request({
    url: "/business/count",
    method: "GET",
    data: params
  })
}
// 司法涉诉 分类数据统计
export function judicialInvolvementCountApi(params: any) {
  return request({
    url: "/judicialInvolvement/count",
    method: "GET",
    data: params
  })
}
/** 经营异常总数量 */
export function getOperationalRiskApi(params: any) {
  return request({
    url: "/operationalRisk/count",
    method: "GET",
    data: params
  })
}
